// Evol scripts.
// Author:
//    Reid
// Description:
//    Old man living in the rich hill, can bleach clothes.

001-2-12,38,30,0	script	Oscar#001-2-12	NPC_OSCAR,{

    function live_here_alone
    {
        speech 5,
            l("Meh!"),
            l("This is a harsh word to use, you are never alone in the beautiful place of Artis."),
            l("Mob is doing its daily noise, nature is singing its sumptuous melody, none is alone.");

        return;
    }

    function item_is_bleachable
    {
        .@item_index = getarg(0);
        if (.@item_index < 0)
            return false;

        getinventorylist;

        if (@inventorylist_card1[.@item_index] != 0)
        {
            if ((@inventorylist_card1[.@item_index] > YellowCottonDye) ||
                (@inventorylist_card1[.@item_index] < CrimsonCashmereDye))
            {
                return false;
            }
            .@is_bleachable = true;
        }
        if (@inventorylist_card2[.@item_index] != 0)
        {
            if ((@inventorylist_card2[.@item_index] > YellowCottonDye) ||
                (@inventorylist_card2[.@item_index] < CrimsonCashmereDye))
            {
                return false;
            }
            .@is_bleachable = true;
        }
        if (@inventorylist_card3[.@item_index] != 0)
        {
            if ((@inventorylist_card3[.@item_index] > YellowCottonDye) ||
                (@inventorylist_card3[.@item_index] < CrimsonCashmereDye))
            {
                return false;
            }
            .@is_bleachable = true;
        }
        if (@inventorylist_card4[.@item_index] != 0)
        {
            if ((@inventorylist_card4[.@item_index] > YellowCottonDye) ||
                (@inventorylist_card4[.@item_index] < CrimsonCashmereDye))
            {
                return false;
            }
            .@is_bleachable = true;
        }

        return .@is_bleachable;
    }

    function remove_cards_from_item
    {
        .@item_index = -1;

        speech 1,
            l("What item would you like to bleach?");

        narrator 5,
            l("You can drag and drop an item to the NPC window or select an item through your inventory.");

        .@item_index = requestitemindex();
        if (!item_is_bleachable(.@item_index))
        {
            speech 4,
                l("You should know this, an item like this can't be bleached.");

            return;
        }

        speech 4,
            l("Your mind is set? You will loose the color dye during this process.");

        switch (askyesno())
        {
            case 1:
                speech 5,
                    l("Ok, let me see..."),
                    l("...");

                failedremovecardsindex .@item_index, 1;

                speech 12,
                    l("..."),
                    l("Here it is, clean like a whistle!");
                break;
            case 2:
                speech 5,
                    l("Is it truly a hard choice to make?");
                break;
        }

        return;
    }

    .@hour = gettime(GETTIME_HOUR);
    speech 4, (.@hour > 6 && .@hour < 18) ? l("Good day to you.") : lg("Good night milady.", "Good evening sir.");

    do
    {
        select
            l("Could you bleach my clothes?"),
            l("Do you live here alone?"),
            menuaction(l("Quit"));

        switch (@menu)
        {
            case 1:
                remove_cards_from_item();
                break;
            case 2:
                live_here_alone();
                break;
            case 3:
                speech 5, l("I wish you a good time in town.");
                break;
        }

    } while (@menu != 3);

    closedialog;
    goodbye;
    close;

OnInit:
    .sex = G_MALE;
    .distance = 3;
    end;
}

